a=read.table("C:\\Users\\37761\\Desktop\\R语言\\第三次\\ADdata1.txt")
b=read.table("C:\\Users\\37761\\Desktop\\R语言\\第三次\\ADdata4.txt")
c=read.csv("C:\\Users\\37761\\Desktop\\R语言\\第三次\\ADdata2.csv")
library("openxlsx")
d=read.xlsx("C:\\Users\\37761\\Desktop\\R语言\\第三次\\ADdata3.xlsx")
e=read.csv("C:\\Users\\37761\\Desktop\\R语言\\第三次\\k.csv")
#####第一题直方图####
n1=unlist(a)#将列表（n1）转换为一个单一的向量
n1=log10(n1)#将数据缩小，美化直方表
hist(n1,label=TRUE)#画图·
n2=unlist(b)
n2=log10(n2)
hist(n2,label=TRUE)
c1=c[,-1]
n3=unlist(c1)
n3=log10(n3)
hist(n3)
####第二题树状图####
distance=dist(a)
hcdata=hclust(distance,method="average")
plot(hcdata)
####第三题火山图####
rm(list=ls())
load("C:\\Users\\37761\\Desktop\\R语言\\第四次\\volcano.RData")
jpeg('volcano.jpg',width = 1000,height = 1000)
label = subset(prostat,P<0.05 & abs(FC)>log2(1.2))
Significant=ifelse((prostat$P<0.05 & abs(prostat$FC)> log2(1.2)), ifelse(prostat$FC > log2(1.2),"Up","Down"), "Not")
ggplot(prostat, aes(FC, -log10(P)))+
  geom_point(aes(col=Significant))+
  scale_color_manual(values=c("#0072B5","grey","#BC3C28"))+
  labs(title = " ")+
  geom_vline(xintercept=c(-log2(1.2),log2(1.2)), colour="black", linetype="dashed")+
  geom_hline(yintercept = -log10(0.05),colour="black", linetype="dashed")+
  theme(plot.title = element_text(size = 16, hjust = 0.5, face = "bold"))+
  labs(x="log2(FoldChange)",y="-log10(P)")+
  theme(axis.text=element_text(size=13),axis.title=element_text(size=13))+theme_bw()
dev.off()
##借鉴ai

